<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>游戏后台管理系统</title>
		<c:set var="ctx" value="${pageContext.request.contextPath}" />
		<meta name="description" content="Draggabble Widget Boxes with Persistent Position and State" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/css/jquery-ui.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/css/jquery.gritter.min.css" />
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/jquery-ui.custom.min.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/fonts.googleapis.com.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="${ctx }/static/assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
		<![endif]-->
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace-rtl.min.css" />

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="${ctx }/static/assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="${ctx }/static/assets/js/ace-extra.min.js"></script>

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="${ctx }/static/assets/js/html5shiv.min.js"></script>
		<script src="${ctx }/static/assets/js/respond.min.js"></script>
		<![endif]-->
		<style>
		.no-close .ui-dialog-titlebar-close {
		  display: none;
		}
		</style>
	</head>

	<body class="no-skin">
		<div id="navbar" class="navbar navbar-default          ace-save-state">
			<div class="navbar-container ace-save-state" id="navbar-container">
				<!-- 响应手机屏幕布局时的主菜单按钮 -->
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
					<span class="sr-only">Toggle sidebar</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<div class="navbar-header pull-left">
					<a href="${ctx}/admin" class="navbar-brand">
						<small>
							游戏后台管理系统
						</small>
					</a>
				</div>
				<!-- 用户信息 -->
				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="light-blue dropdown-modal">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								<img class="nav-user-photo" src="${ctx }/static/assets/images/avatars/user.jpg" alt="Jason's Photo" />
								<span class="user-info">
									${sessionScope.session_admin_user_key.name}
								</span>
								<i class="ace-icon fa fa-caret-down"></i>
							</a>
							<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<%--<li>
									<a href="#">
										<i class="ace-icon fa fa-cog"></i>
										设置
									</a>
								</li>

								<li>
									<a href="profile.html">
										<i class="ace-icon fa fa-user"></i>
										用户信息
									</a>
								</li>
								<li class="divider"></li>--%>
								<li>
									<a href="${ctx }/login/logout">
										<i class="ace-icon fa fa-power-off"></i>
										登出
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</div><!-- /.navbar-container -->
			<div id="dialog-confirm" class="hide">
			</div><!-- #dialog-confirm -->
		</div>
		
		<div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
			</script>

			<div id="sidebar" class="sidebar                  responsive                    ace-save-state">
				<script type="text/javascript">
					try{ace.settings.loadState('sidebar')}catch(e){}
				</script>
				<ul class="nav nav-list" id="mainMenu">
					<%--<li class="">
						<a style="cursor: pointer;" onclick="javascript:$(myTab).find('a:first').click();" class="dropdown-toggle">
							<i class="menu-icon fa fa-tachometer"></i>
							<span class="menu-text">
								后台首页
							</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
					</li>
					<li class="">
						<a style="cursor: pointer;" class="dropdown-toggle">
							<i class="menu-icon fa fa-users"></i>
							<span class="menu-text">
								用户管理
							</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a style="cursor: pointer;" class="dropdown-toggle">
									<i class="menu-icon fa fa-gamepad"></i>
									玩家管理
									<b class="arrow fa fa-angle-down"></b>
								</a>
								<b class="arrow"></b>
								<ul class="submenu">
									<li class="">
										<a href="${ctx }/admin/usermanager/myPlayer" class="dropdown-toggle">
											<i class="menu-icon fa fa-user"></i>
											<span>我的玩家</span>
											<b class="arrow fa fa-angle-down"></b>
										</a>
									</li>
								</ul>
							</li>
							<li class="">
								<a href="${ctx }/admin/usermanager/myAgent" style="cursor: pointer;" class="dropdown-toggle">
									<i class="menu-icon fa fa-paper-plane"></i>
									<span>代理信息</span>
									<b class="arrow fa fa-angle-down"></b>
								</a>
							</li>
						</ul>
					</li>
					<li class="">
						<a style="cursor: pointer;" class="dropdown-toggle">
							<i class="menu-icon fa fa-jpy"></i>
							<span class="menu-text">
								财务管理
							</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a style="cursor: pointer;" class="dropdown-toggle">
									<i class="menu-icon fa fa-credit-card-alt"></i>
									<span>线下充值管理</span>
									<b class="arrow fa fa-angle-down"></b>
								</a>
							</li>
							<li class="">
								<a style="cursor: pointer;" class="dropdown-toggle">
									<i class="menu-icon fa fa-credit-card"></i>
									<span>线上充值管理</span>
									<b class="arrow fa fa-angle-down"></b>
								</a>
							</li>
							<li class="">
								<a style="cursor: pointer;" class="dropdown-toggle">
									<i class="menu-icon fa fa-pie-chart"></i>
									<span>充值统计报表</span>
									<b class="arrow fa fa-angle-down"></b>
								</a>
							</li>
						</ul>
					</li>--%>
				</ul><!-- /.nav-list -->

				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>
			</div>

			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
						<div class="row">
							<div class="tabbable">
								<ul class="nav nav-tabs" id="myTab">
									<li class="active">
										<a data-toggle="tab" href="#home" aria-expanded="true">
											<i class="green ace-icon fa fa-home bigger-120"></i>
											<span>后台首页</span>
										</a>
									</li>
								</ul>

								<div class="tab-content" id="myTabContent" style="border:none;border-top:1px solid #C5D0DC;display: block;padding:0px;padding-top:5px;" >
									<div id="home" class="tab-pane fade active in">
										<div class="row">
											<div class="col-xs-12">
											<div class="space-6"></div>
											<div  class="alert alert-block alert-success">
												<button type="button" class="close" data-dismiss="alert">
													<i class="ace-icon fa fa-times"></i>
												</button>
												<i class="ace-icon fa fa-check green"></i> 欢迎使用 游戏后台管理系统
											</div>
											<div class="space-6"></div>
												<div class="col-sm-7 infobox-container">
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-green">
														<div class="infobox-icon">
															<i class="ace-icon fa fa-gamepad"></i>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.onlineCount }</span>
															<div class="infobox-content">当前在线人数</div>
														</div>
			
													</div>
			
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-blue">
														<div class="infobox-icon">
															<i class="ace-icon fa fa-user-plus"></i>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.subPlayerCount }</span>
															<div class="infobox-content">下属玩家</div>
														</div>
			
														
													</div>
			
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-pink">
														<div class="infobox-icon">
															<i class="ace-icon fa fa-paper-plane"></i>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.subAgentCount }</span>
															<div class="infobox-content">下属代理</div>
														</div>
													</div>
			
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-red">
														<div class="infobox-icon">
															<i class="ace-icon fa fa-diamond"></i>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.totalFeeCountStr }</span>
															<div class="infobox-content">总充值金额</div>
														</div>
													</div>
			
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-orange2">
														<div class="infobox-chart">
															<span class="sparkline" data-values="196,128,202,177,154,94,100,170,224">
															<i class="ace-icon fa fa-rmb"></i>
															</span>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.todayTotalFeeCount }</span>
															<div class="infobox-content">今日充值金额</div>
														</div>
													</div>
			
													<div style="cursor: default;" class="btn btn-info btn-white  infobox infobox-orange2">
														<div class="infobox-chart">
															<span class="sparkline" data-values="196,128,202,177,154,94,100,170,224">
															<i class="ace-icon fa fa-legal"></i>
															</span>
														</div>
			
														<div class="infobox-data">
															<span class="infobox-data-number">${indexData.todayTotalCount }</span>
															<div class="infobox-content">今日充值笔数</div>
														</div>
													</div>
			
													<div class="space-6"></div>
			
													<button onclick=javascript:$("a[href='admin/usermanager/myPlayer']").click() class="btn btn-warning btn-xlg">
													<i class="ace-icon fa fa-user"></i>查看我的玩家
													</button>
			
													<button onclick=javascript:$("a[href='admin/usermanager/myAgent']").click() style="margin-left:5px;" class="btn btn-success btn-xlg">
													<i class="menu-icon fa fa-paper-plane"></i>
													查看我的代理</button>
			
													<button onclick=javascript:$("a[href='admin/usermanager/myPlayerPay']").click() style="margin-left:5px;" class="btn btn-info btn-xlg">
													<i class="menu-icon fa fa-credit-card-alt"></i>
													充值</button>
												</div>
			
			
												<div class="col-sm-5">
													<div class="widget-box">
														<div class="widget-header widget-header-flat widget-header-small">
															<h5 class="widget-title">
																<i class="ace-icon fa fa-user"></i>
																账号信息
															</h5>
														</div>
			
														<div class="widget-body">
															<div class="profile-user-info profile-user-info-striped hover" style="border:none;width:100%;margin:0">
																<div class="profile-info-row">
																	<div class="profile-info-name"> 账号名称 </div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" id="username">${session_admin_user_key.name }</span>
																	</div>
																</div>
				
																<div class="profile-info-row">
																	<div class="profile-info-name"> 登陆账号 </div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" id="username">${session_admin_user_key.account }</span>
																	</div>
																</div>
				
																<div class="profile-info-row">
																	<div class="profile-info-name"> 角色 </div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" >${session_admin_user_key.roleName }</span>
																	</div>
																</div>
				
																<div class="profile-info-row">
																	<div class="profile-info-name"> 关联用户</div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" id="signup">
																			<c:forEach items="${session_admin_user_key.userInfoDtoList}" var="item" varStatus="idx">
																			${item.userId}<c:if test="${idx.last==false}">,</c:if>
																		</c:forEach>
																		</span>
																	</div>
																</div>
				
																<div class="profile-info-row">
																	<div class="profile-info-name"> 联系方式 </div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" id="login">${session_admin_user_key.mobile }</span>
																	</div>
																</div>
				
																<div class="profile-info-row">
																	<div class="profile-info-name"> 当前IP </div>
				
																	<div class="profile-info-value">
																		<span class="editable editable-click" id="about"><%=request.getRemoteAddr() %></span>
																	</div>
																</div>
															</div>
														</div><!-- /.widget-body -->
													</div><!-- /.widget-box -->
												</div><!-- /.col -->
											</div>
										</div>
										<div class="space-6"></div>
										<div class="widget-header widget-header-large">
											<h3 class="widget-title grey lighter">
												<i class="ace-icon fa fa-leaf green"></i>
												最新充值动态
											</h3>

											<div class="widget-toolbar no-border invoice-info">
												<br/>
												<span class="invoice-info-label">当前时间:</span>
												<span id="systime" class="blue"></span>
											</div>

											
										</div>
										<div class="space-6"></div>
											<table class="table table-striped table-bordered table-hover">
															<thead>
																<tr>
																	<th class="center">用户id</th>
																	<th class="center">状态</th>
																	<th class="center">用户昵称</th>
																	<th class="center">邀请人</th>
																	<th  class="center">支付方式</th>
																	<th class="center">商品描述</th>
																	<th class="center">充值金额</th>
																	<th class="center">充值时间</th>
																</tr>
															</thead>

															<tbody>
																<c:forEach items="${indexData.newest }" var="itm">
																	<tr>
																	<td class="center">${itm.userId }</td>
																	<td class="center">
																		<c:set var="checked" value="checked=checked" />
																		<c:if test="${itm.status == 0}">
																		<c:set var="checked" value="" />
																		</c:if>
																		<label>
																			<input name="switch-field-1"  onclick="return false;" class="ace ace-switch ace-switch-3" type="checkbox" ${checked }>
																			<span class="lbl" style='cursor:auto;'></span>
																		</label>
																	</td>
																	<td class="center">
																		${itm.nickName }
																	</td>
																	<td class="center">
																		${itm.fatherAgentId }(${itm.fatherNickName })
																	</td>
																	<td class="center">
																	<c:if test="${itm.appSystem == 'ANDROID'}"><i class="fa fa-android" aria-hidden="true"></i></c:if>
																	<c:if test="${itm.appSystem == 'IOS'}"><i class="menu-icon fa fa-apple"></i></c:if>
																	<c:if test="${fn:startsWith(itm.seqNo, 'A')}"></i>支付宝</c:if>
																	<c:if test="${fn:startsWith(itm.seqNo, 'W')}">微信</c:if>
																	</td>
																	<td class="center"> ${itm.body } </td>
																	<td class="center">${itm.fee }</td>
																	<td class="center">${itm.inputTime }</td>
																</tr>
																</c:forEach>
															</tbody>
														</table>
											
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div><!-- /.main-content -->
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="${ctx }/static/assets/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="${ctx }/static/assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='${ctx }/static/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="${ctx }/static/assets/js/bootstrap.min.js"></script>
		<script src="${ctx }/static/assets/js/jquery-ui.min.js"></script>
		<!-- page specific plugin scripts -->
		<script src="${ctx }/static/assets/js/jquery-ui.custom.min.js"></script>
		<script src="${ctx }/static/assets/js/jquery.ui.touch-punch.min.js"></script>

		<!-- ace scripts -->
		<script src="${ctx }/static/assets/js/ace-elements.min.js"></script>
		<script src="${ctx }/static/assets/js/jquery.gritter.min.js"></script>
		<script src="${ctx }/static/assets/js/ace.min.js"></script>
		<script src="${ctx }/static/assets/js/bootbox.js"></script>
		<script src="${ctx }/static/js/common.js"></script>
		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
				_title: function(title) {
					var $title = this.options.title || '&nbsp;'
					if( ("title_html" in this.options) && this.options.title_html == true )
						title.html($title);
					else title.text($title);
				}
			}));
			var ctx = '${ctx}';
			var menusJson = $.parseJSON('${menus}');
			var html = '<li class="">' +
            '<a style="cursor: pointer;" onclick="javascript:$(myTab).find(\'a:first\').click();" class="dropdown-toggle">' +
			'<i class="menu-icon fa fa-tachometer"></i>' +
            '<span class="menu-text">' +
            '后台首页' +
            '</span>' +
            '<b class="arrow fa fa-angle-down"></b>' +
            '</a>' +
            '</li>';
			var rootMenus = $.grep(menusJson, function(obj,i){
                return obj.parentId == 0;
            });
            if(rootMenus && rootMenus.length > 0){
                $.each(rootMenus, function(index,obj){
                    //console.log("root节点" + obj.id + "=" + obj.name);
                    html += '<li class="">' +
                    '<a style="cursor: pointer;" class="dropdown-toggle">' +
                    '<i class="' + obj.icon + '"></i>' +
                    '<span class="menu-text">' +
					obj.name +
                    '</span>' +
                    '<b class="arrow fa fa-angle-down"></b>' +
                    '</a>';
                    getChilder(obj.id);
                    html += '</li>';
                });
            }
            $("#mainMenu").html(html);

			function getChilder(menuId) {
				var childMenus = $.grep(menusJson, function(obj,index){
                    return obj.parentId == menuId;
				});
				if(childMenus && childMenus.length > 0){
                    html += '<b class="arrow"></b>' +
					'<ul class="submenu">';
					$.each(childMenus, function(index,obj){
                        //console.log("子节点" + obj.id + "=" + obj.name);
                        html += '<li class="">' +
                        '<a style="cursor: pointer;" class="dropdown-toggle"';
						if(obj.url && obj.url!=''){
                            html += 'href="' + ctx + obj.url + '"';
						}
                        html += '>' +
                        '<i class="' + obj.icon + '"></i>' +
						'<span>' + obj.name + '</span>' +
                        '<b class="arrow fa fa-angle-down"></b>' +
                        '</a>';
                        getChilder(obj.id);
                        html += '</li>';
                    });
                    html += '</ul>';
				}
            }
		</script>
	</body>
</html>
